import Vue from "vue";
import Vuex from "vuex";
import createPersistedState from "vuex-persistedstate";


import order from "./modules/order";
import login from "./modules/login";
import user from "./modules/user";
import product from "./modules/product"
import index from "./modules/index"



//引入vuex
Vue.use(Vuex)


//创建store实例

const store = new Vuex.Store({
    modules:{
        product,
        order,
        user,
        login,
        index
    },
    plugins:[
        createPersistedState(
            {
                storage: window.sessionStorage,
                reducer(val) {
                    return {"login":{token:val.login.token}}
                }

            })
    ]
})






export default store


